﻿window.onload = function() {

    startList = function() {
        if (document.all && document.getElementById) {
            navRoot = document.getElementById("mainNav");
            for (i = 0; i < navRoot.childNodes.length; i++) {
                node = navRoot.childNodes[i];
                if (node.nodeName == "LI") {
                    node.onmouseover = function() {
                        this.className += " over";
                    }
                    node.onmouseout = function() {
                        this.className = this.className.replace(" over", "");
                    }
                }
            }

            preferencesRoot = document.getElementById("preNav");
            if (preferencesRoot) {
                for (i = 0; i < preferencesRoot.childNodes.length; i++) {
                    node = preferencesRoot.childNodes[i];
                    if (node.nodeName == "LI") {
                        node.onmouseover = function() {
                            this.className += " over";
                        }
                        node.onmouseout = function() {
                            this.className = this.className.replace(" over", "");
                        }
                    }
                }
            }
            inputs = document.getElementsByTagName("input");
            for (i = 0; i < inputs.length; i++) {
                input = inputs[i];

                if (input.type == 'text' || input.type == "password" || input.type == "file") {
                    input.onfocus = function() {
                        this.className += "over";
                    }
                    input.onblur = function() {
                        this.className = this.className.replace("over", "");
                    }
                }
            }
            textareas = document.getElementsByTagName("textarea");
            for (i = 0; i < textareas.length; i++) {
                textarea = textareas[i];

                    textarea.onfocus = function() {
                        this.className += "over";
                    }
                    textarea.onblur = function() {
                        this.className = this.className.replace("over", "");
                    }
                
            }
        }
    }
    startList();
};